package cn.doit.scala.day04

/**
 * @DATE 2021/12/28/9:15
 * @Author MDK
 * @Version 2021.2.2
 * */
object C01_Partition {
  def main(args: Array[String]): Unit = {
    val list: List[Int] = List[Int](1, 2, 3, 4, 5, 6, 7, 8, 9)
    val tuple = list.partition(_ > 3)
    println(tuple._1)
    println(tuple._2)

    println("-------------------------------------------")
    val mp = Map("peiqi" -> 5, "jong" -> 3, "baji" -> 12)
    val tuple1 = mp.partition(_._2 > 3)
    println(tuple1._1)
    println(tuple1._2)

    println("------------------")
    val array: Array[Any] = Array[Any]("java", "scala", "sql", 12.23, 34, 'a', 1)
    val res = array.partition(_.isInstanceOf[String])._1
    res.foreach(e=>print(e.asInstanceOf[String].toUpperCase + "\t"))
  }
}
